package com.aigis.big4.tmp.javase.thread.queue;


import com.aigis.big4.tmp.javase.thread.User;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class BoxQueue {

    public static void main(String[] args){
        //共享资源队列,
        // LinkedBlockingQueue 阻塞对列，先进先出，
        // 适合高并发处理
        BlockingQueue<User> blockingQueue=new LinkedBlockingQueue<User>(10);

        ProduceQueue produce=new ProduceQueue(blockingQueue);
        ConsumerQueue consumer=new ConsumerQueue(blockingQueue);
        // 开启连个线程，一个做生产者,一个消费者
        Thread pro=new Thread(produce);
        Thread con=new Thread(consumer);
        pro.start();
        con.start();
    }
}
